package com.crawler.harbour.utils;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

public class DES
{
  private static byte[] iv = { 1, 2, 3, 4, 5, 6, 7, 8 };

  public static String encryptDES(String paramString1, String paramString2) throws IllegalBlockSizeException, BadPaddingException, Exception
  {
    IvParameterSpec localIvParameterSpec = new IvParameterSpec(iv);
    SecretKeySpec localSecretKeySpec = new SecretKeySpec(paramString2.getBytes(), "DES");
    Cipher localCipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
    localCipher.init(1, localSecretKeySpec, localIvParameterSpec);
    return Base64Util.encode(localCipher.doFinal(paramString1.getBytes()));
  }

}